﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EventViewToExceptionless
{
    public interface IServiceStackRedis
    {/// <summary>
     /// 根据Key获取value值
     /// </summary>
     /// <typeparam name="T"></typeparam>
     /// <param name="key"></param>
     /// <returns></returns>
        T Get<T>(string key);

        /// <summary>
        /// 根据key删除缓存
        /// </summary>
        /// <param name="keys"></param>
        /// <returns></returns>
        bool KeyDelete(params string[] keys);

        /// <summary>
        /// 是否存在
        /// </summary>
        /// <param name="key"></param>
        /// <returns>true:存在，false:不存在</returns>
        bool KeyExists(string key);

        /// <summary>
        /// 加入redis缓存
        /// </summary>
        /// <param name="key"></param>
        /// <param name="obj"></param>
        /// <param name="expirationSeconds">过期时间，单位：秒</param>
        /// <returns></returns>
        void Set<T>(string key, T obj, int expirationSeconds = 60);
    }
}
